import Mock from 'mockjs'
import {doCustomTimes} from '@/libs/util'
import orgData from './data/org-data'
import {treeData} from './data/tree-select'

const Random = Mock.Random

export const getTableData = () => {
    let tableData = []
    doCustomTimes(5, () => {
        tableData.push(Mock.mock({
            name: '@name',
            email: '@email',
            createTime: '@date'
        }))
    })
    return tableData
}

export const getApiList = () => {
    let apiList = {
        data: [],
        page: {
            pageSize: 13,
            pageTotal: 6,
            rowTotal: 60,
        }
    };
    doCustomTimes(13, () => {
        apiList.data.push(Mock.mock({
            url: '@url',
            'parms|1': ['a', 'b', 'c', 'd'],
            'type|1': ['get', 'post'],
            className: '@classname'
        }))
    })
    return apiList
}

export const getDragList = () => {
    let dragList = []
    doCustomTimes(5, () => {
        dragList.push(Mock.mock({
            name: Random.csentence(10, 13),
            id: Random.increment(10)
        }))
    })
    return dragList
}

export const uploadImage = () => {
    return Promise.resolve()
}

export const getOrgData = () => {
    return orgData
}

export const getTreeSelectData = () => {
    return treeData
}
